<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    
    <body>
        
        <ui:composition template="./../../../WEB-INF/templates/noFooterCompanyTemplate.xhtml">

            <ui:define name="content">
                <h:form id="viewFolderForm">
                    <p:growl life="3000" showDetail="false" autoUpdate="true" id="viewFolderGrowl"></p:growl>
                    <p:dialog resizable="false" styleClass="filterProfileDialog" id="filterProfileDialog" widgetVar="filterProfileDialog" modal="true">
                        <!--Sustituir esto por un composite component más adelante!-->
                        <p:panel style="margin-right: 20px;" styleClass="noMargin noPadding noBorder">
                            <div class="viewCandidateColumnTitle personalBackgroundButton">
                                <span>#{messages.BasicSearch}</span>
                            </div>
                            <p:panel id="basicSearchPanel" styleClass="noBorder noPadding noMargin">
                                <p:panelGrid style="margin-top: 16px" styleClass="noMargin noPadding noBorder noSidePaddingCell" columns="1">  
                                    <p:selectOneMenu converter="#{sexConverter}" id="selectSearchSex" value="#{viewFolderBean.search.sex}" effect="fade" required="false" label="#{messages.Sex}" requiredMessage="#{messages.SexRequired}">  
                                        <f:selectItem itemLabel="#{messages.Sex}" itemValue="" />  
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{userResourcesBean.sexs}" var="sex" itemLabel="#{sexBundle[sex.idSex.toString()]}" itemValue="#{sex}"/>  
                                    </p:selectOneMenu>

                                    <p:inputText id="minimumAge" value="#{viewFolderBean.search.minimumAge}" required="false" label="#{messages.Name}">  
                                        <f:convertNumber integerOnly="true" maxIntegerDigits="2" minIntegerDigits="2"></f:convertNumber>
                                    </p:inputText>
                                    <p:watermark for="minimumAge" value="#{messages.MinimumAge}" />

                                    <p:inputText id="maximumAge" value="#{viewFolderBean.search.maximumAge}" required="false" label="#{messages.Name}">  
                                        <f:convertNumber integerOnly="true" maxIntegerDigits="2" minIntegerDigits="2"></f:convertNumber>
                                    </p:inputText>
                                    <p:watermark for="maximumAge" value="#{messages.MaximumAge}" />

                                    <p:selectOneMenu converter="#{countryConverter}" id="selectCountry" value="#{viewFolderBean.search.offerCountry}" effect="fade" required="false" label="#{messages.Country}" requiredMessage="#{messages.CountryRequired}">  
                                        <f:selectItem itemLabel="#{messages.OfferCountry}" itemValue="" />
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItem itemLabel="#{countryBundle[resourcesBean.spain.idCountry.toString()]}" itemValue="#{resourcesBean.spain}" /> 
                                        <f:selectItems value="#{resourcesBean.countries}" var="country" itemLabel="#{countryBundle[country.idCountry.toString()]}" itemValue="#{country}"/>  
                                    </p:selectOneMenu>

                                    <p:selectOneMenu converter="#{provinceConverter}" id="selectProvince" value="#{viewFolderBean.search.offerProvince}" effect="fade" required="false" label="#{messages.Province}" requiredMessage="#{messages.ProvinceRequired}">  
                                        <f:selectItem itemLabel="#{messages.OfferProvince}" itemValue="" /> 
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{viewFolderBean.search.offerCountry.provinceList}" var="province" itemLabel="#{province.description}" itemValue="#{province}"/>  
                                    </p:selectOneMenu>

                                    <p:selectOneMenu converter="#{sectorConverter}" id="selectBasicProfessionalSector" value="#{viewFolderBean.search.professionalInfoSector}" effect="fade" required="false" label="#{messages.ExperienceInSector}" requiredMessage="#{messages.ProvinceRequired}">  
                                        <f:selectItem itemLabel="#{messages.ExperienceInSector}" itemValue="" />  
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{resourcesBean.sectors}" var="basicProfessionalSector" itemLabel="#{sectorBundle[basicProfessionalSector.idSector.toString()]}" itemValue="#{basicProfessionalSector}"/>  
                                    </p:selectOneMenu>

                                    <p:selectOneMenu converter="#{jobDurationConverter}" id="selectBasicMinimumJobDuration" value="#{viewFolderBean.search.professionalInfoMinimumJobDuration}" effect="fade" required="false" label="#{messages.MinimumJobDuration}" requiredMessage="#{messages.ProvinceRequired}">  
                                        <f:selectItem itemLabel="#{messages.MinimumJobDuration}" itemValue="" />  
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{resourcesBean.jobDurations}" var="basicMinimumJobDuration" itemLabel="#{jobDurationBundle[basicMinimumJobDuration.idJobDuration.toString()]}" itemValue="#{basicMinimumJobDuration}"/>  
                                    </p:selectOneMenu>

                                    <p:selectOneMenu required="false" requiredMessage="#{messages.EducationalLevelRequired}" converter="#{educationalLevelConverter}" id="selectBasicMinimumEducationalLevel" value="#{viewFolderBean.search.educationalInfoMinimumEducationalLevel}" effect="fade" label="#{messages.EducationalLevel}">  
                                        <f:selectItem itemLabel="#{messages.MinimumEducationalLevel}" itemValue="" />  
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{resourcesBean.educationalLevels}" var="basicMinimumEducationalLevel" itemLabel="#{educationalLevelBundle[basicMinimumEducationalLevel.idEducationalLevel.toString()]}" itemValue="#{basicMinimumEducationalLevel}"/>  
                                    </p:selectOneMenu>

                                    <p:selectOneMenu rendered="#{viewFolderBean.search.educationalInfoMinimumEducationalLevel.educationalValue>'2'}" converter="#{sectorConverter}" id="selectBasicEducationalSector" value="#{viewFolderBean.search.educationalInfoSector}" effect="fade" label="#{messages.Sector}">  
                                        <f:selectItem itemLabel="#{messages.StudiesSector}" itemValue="" />  
                                        <f:selectItem itemLabel="#{messages.Indiferent}" itemValue="" /> 
                                        <f:selectItems value="#{resourcesBean.sectors}" var="basicEducationalSector" itemLabel="#{sectorBundle[basicEducationalSector.idSector.toString()]}" itemValue="#{basicEducationalSector}"/>  
                                    </p:selectOneMenu>
                                    
                                    <p:selectOneMenu required="false" filter="true" filterMatchMode="contains" converter="#{companyAdquiredProfileFolderStateConverter}" id="companyAdquiredProfileFolderStateDialog"  value="#{viewFolderBean.search.companyAdquiredProfileFolderState}" effect="fade" >  
                                        <f:selectItem itemLabel="#{messages.State}" itemValue="" />  
                                        <f:selectItems value="#{userResourcesBean.companyAdquiredProfileFolderState}" var="companyAdquiredProfileFolderState" itemLabel="#{companyAdquiredProfileFolderStateBundle[companyAdquiredProfileFolderState.idCompanyAdquiredProfileFolderState.toString()]}" itemValue="#{companyAdquiredProfileFolderState}"/>  
                                    </p:selectOneMenu>
                                </p:panelGrid>
                            </p:panel>
                        </p:panel>
                        <p:commandButton style="margin-top: 30px;" styleClass="cropButton imageBackgroundButton" value="#{messages.Filter}" update=":viewFolderForm:facesWrapPanel :viewFolderForm:filterProfileDialog" actionListener="#{viewFolderBean.filter()}"  />                        
                    </p:dialog>
                    
                    <p:dialog resizable="false" styleClass="candidateDetailDialog" id="candidateDetailDialog" widgetVar="candidateDetailDialog" modal="true">
                        <p:panel rendered="#{viewFolderBean.selectedAdquiredProfile.candidate!=null}" id="sumaryInfoPanel" styleClass="viewDetailAdquiredInfoPanel noMargin noPadding noBorder">
                            <p:panel styleClass="block dialogHeader marginBottom20">
                                <p:selectOneMenu required="false" filter="true" filterMatchMode="contains" converter="#{companyAdquiredProfileFolderStateConverter}" id="companyAdquiredProfileFolderState"  value="#{viewFolderBean.companyAdquiredProfileFolder.companyAdquiredProfileFolderState}" effect="fade" >  
                                    <f:selectItem itemLabel="#{messages.State}" itemValue="" />  
                                    <f:selectItems value="#{userResourcesBean.companyAdquiredProfileFolderState}" var="companyAdquiredProfileFolderState" itemLabel="#{companyAdquiredProfileFolderStateBundle[companyAdquiredProfileFolderState.idCompanyAdquiredProfileFolderState.toString()]}" itemValue="#{companyAdquiredProfileFolderState}"/>  
                                    <p:ajax event="change" process="@this" listener="#{viewFolderBean.setNewAdquiredProfileFolderState()}" />
                                </p:selectOneMenu>
                                <h:outputText styleClass="titleText floatRight right capitalizedText" value="#{viewFolderBean.selectedAdquiredProfile.candidate.name}"></h:outputText>
                            </p:panel>
                            <p:panel styleClass="block dialogHeader marginBottom20">
                                <p:selectOneMenu converter="#{companyFolderConverter}" id="selectCompanyFolder" value="#{viewFolderBean.selectedFolder}" effect="fade" required="false" label="#{messages.SelectFolder}" requiredMessage="#{messages.FolderRequired}">  
                                    <f:selectItem itemLabel="#{messages.SelectFolder}" itemValue="" />  
                                    <f:selectItems value="#{viewFolderBean.company.companyFolderList}" var="companyFolder" itemLabel="#{companyFolder.description}" itemValue="#{companyFolder}"/>  
                                </p:selectOneMenu>
                                <p:commandButton style="vertical-align:top; margin-top: 5px" styleClass="marginLeft20 interestBackgroundButton" oncomplete="candidateDetailDialog.hide();" action="#{viewFolderBean.copyProfile()}" value="#{messages.Copy}"></p:commandButton>
                            </p:panel>
                            <p:panel styleClass="noMargin noPadding noBorder detailCandidatePanel">
                                <div class="viewCandidateColumnTitle personalBackgroundButton">
                                    <span>#{messages.SearchGeneralInformation}</span>
                                </div>
                                <h:outputText class="viewCandidateLabel capitalizedText" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.name!=null}" value="#{viewFolderBean.selectedAdquiredProfile.candidate.name}"></h:outputText>
                                <h:outputText class="viewCandidateText" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.birthDay!=null}" value="#{viewFolderBean.dateDifference(viewFolderBean.selectedAdquiredProfile.candidate.birthDay)} #{messages.Years}"></h:outputText>
                                <h:outputFormat class="viewCandidateText marginBottom20" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.country!=null and viewFolderBean.selectedAdquiredProfile.candidate.province!=null}" value="#{messages.IndexLocationMessage}">
                                    <f:param value="#{viewFolderBean.selectedAdquiredProfile.candidate.province.description}"></f:param>
                                    <f:param value="#{countryBundle[viewFolderBean.selectedAdquiredProfile.candidate.country.idCountry.toString()]}"></f:param>
                                </h:outputFormat>
                                <h:outputText class="viewCandidateText" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.phone!=null}" value="#{viewFolderBean.selectedAdquiredProfile.candidate.phone}"></h:outputText>
                                <h:outputText class="viewCandidateText" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.user.email!=null}" value="#{viewFolderBean.selectedAdquiredProfile.candidate.user.email}"></h:outputText>
                                <div class="viewCandidateColumnTitle educationalBackgroundButton">
                                    <span>#{messages.Profile}</span>
                                </div>
                                <ui:repeat varStatus="professionalIteration" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.differentProfessionalTargetSectors!=null and !viewFolderBean.selectedAdquiredProfile.candidate.differentProfessionalTargetSectors.isEmpty()}" var="differentSector" value="#{viewFolderBean.selectedAdquiredProfile.candidate.differentProfessionalTargetSectors}">
                                    <h:outputText styleClass="bodyText" value="#{sectorBundle[differentSector.idSector.toString()]}"></h:outputText>
                                    <h:outputText styleClass="bodyText" rendered="#{!professionalIteration.last}" value=", "></h:outputText>
                                </ui:repeat>
                                <div class="marginBottom20"></div>
                                <div class="viewCandidateColumnTitle languageBackgroundButton">
                                    <span>#{messages.Language}</span>
                                </div>
                                <ui:repeat varStatus="languageIteration" rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.candidateLanguageInfoList!=null and !viewFolderBean.selectedAdquiredProfile.candidate.candidateLanguageInfoList.isEmpty()}" var="languageInfo" value="#{viewFolderBean.selectedAdquiredProfile.candidate.candidateLanguageInfoList}">
                                    <h:outputText styleClass="bodyText" value="#{languageBundle[languageInfo.language.idLanguage.toString()]} #{languageLevelBundle[languageInfo.languageLevel.idLanguageLevel.toString()]}"></h:outputText>
                                    <h:outputText styleClass="bodyText" rendered="#{!languageIteration.last}" value=", "></h:outputText>
                                </ui:repeat>
                            </p:panel>
                            <h:graphicImage rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.bodyFormal==null}" styleClass="imagenCuerpoDetalle floatRight" library="images" name="silueta3.png"></h:graphicImage>                            
                            <h:graphicImage rendered="#{viewFolderBean.selectedAdquiredProfile.candidate.bodyFormal!=null}" styleClass="imagenCuerpoDetalle floatRight" value="/candidateFiles/#{viewFolderBean.selectedAdquiredProfile.candidate.idCandidate.toString()}/images/#{viewFolderBean.selectedAdquiredProfile.candidate.bodyFormal}"></h:graphicImage>
                        </p:panel>
                        <p:panel rendered="#{viewFolderBean.selectedAdquiredProfile.candidate!=null}" styleClass="noMargin noPadding noBorder">
                           <p:commandButton styleClass="floatRight cropButton imageBackgroundButton" global="false" process="@this" oncomplete="candidateDetailDialog.hide();" action="#{viewFolderBean.seeProfile()}" value="#{messages.SeeProfile}"></p:commandButton>
                           <p:commandButton update=":viewFolderForm:candidateDetailDialog :viewFolderForm:facesWrapPanel" styleClass="floatLeft cropButton interestBackgroundButton" global="false" process="@this" oncomplete="candidateDetailDialog.hide();" action="#{viewFolderBean.removeCompanyAdquiredProfileFolder()}" value="#{messages.Remove}"></p:commandButton>
                        </p:panel>                        
                    </p:dialog>
                    <p:dialog resizable="false" widgetVar="searchDetailDialog" modal="true" id="searchDetailDialog">
                        <p:panel styleClass="previewDialogPanel noMargin noPadding noBorder">
                            <div class="dialogHeader marginBottom20">
                                <h:outputText styleClass="viewCandidateLabel" value="#{searchListBean.selectedSearch.description}"></h:outputText>
                                <h:outputText rendered="#{!searchListBean.previewCandidateList.isEmpty()}" styleClass="bodyText block" value="#{messages.NewCandidatesWaiting}"></h:outputText>
                            </div>
                            <p:dataGrid styleClass="noBorder noMargin noPadding previewFacesDataGrid" emptyMessage="#{messages.NoValidCandidates}" id="facesDataGrid" var="candidate" value="#{searchListBean.previewCandidateList}" columns="3" rows="#{searchListBean.previewCandidateList.size()}" paginator="false" >
                                <p:column styleClass="facesColumn noPadding noMargin noBorder">
                                    <p:panel style="margin-left: 4px;" styleClass="inlineBlock noPadding noBorder previewFacesPanel polaroidBackground rotate#{polaroidBean.randomRotation}">  
                                        <h:panelGrid columns="1" styleClass="noMargin noPadding noBorder previewFacesPanel">  
                                                <h:graphicImage rendered="#{candidate.bustBlackWhite==null}" styleClass="imagenBusqueda" library="images" name="bustnotavailable.jpg"></h:graphicImage>                            
                                                <h:graphicImage rendered="#{candidate.bustBlackWhite!=null}" styleClass="imagenBusqueda" value="/candidateFiles/#{candidate.idCandidate.toString()}/images/#{candidate.bustBlackWhite}"></h:graphicImage>                            
                                            <h:outputText styleClass="polaroidText" value="#{candidate.name}, #{candidate.yearsOld}"></h:outputText>
                                        </h:panelGrid>  
                                    </p:panel> 
                                </p:column>
                            </p:dataGrid>
                            <h:panelGrid style="margin-top: 40px;" styleClass="noBorder allWidth" columns="2">
                                <p:commandButton action="#{searchListBean.viewSearch}" styleClass="cropButton imageBackgroundButton floatRight" value="#{messages.ContinueSearching}"></p:commandButton>
                            </h:panelGrid>
                        </p:panel>
                    </p:dialog>
                    <p:panel id="facesWrapPanel" styleClass="noMargin noPadding noBorder facesWrapPanel">
                        <p:panel styleClass="noPaddingLeftTitle facesDataGrid noMargin noPadding noBorder">
                            <div class="viewCandidateColumnTitle languageBackgroundButton viewFolderTitle inlineBlock right">
                                <span>#{viewFolderBean.currentFolder.description}</span>
                            </div>
                            <p:commandButton onclick="filterProfileDialog.show();" styleClass="viewCandidateColumnTitle greyBackgroundButton inlineBlock viewFolderFilterButton" value="#{messages.Filter}"></p:commandButton>
                            <p:dataGrid emptyMessage="#{messages.NoCandidatesInFolder}" styleClass="noBorder" id="folderFacesDataGrid" var="adquiredProfile" value="#{viewFolderBean.filteredProfiles}" columns="4" rows="#{viewFolderBean.filteredProfiles.size()}" paginator="false" >
                                <p:column disabledSelection="false" styleClass="facesColumn noPadding noMargin">
                                    <p:panel style="margin-left: 4px;" styleClass="inlineBlock noPadding noBorder facesPanel rotation polaroidBackground rotate#{polaroidBean.randomRotation}">  
                                        <h:panelGrid columnClasses="facesColumn" columns="1" styleClass="noMargin noPadding noBorder facesPanel">  
                                            <p:commandLink actionListener="#{viewFolderBean.setSelectedAdquiredProfile(adquiredProfile)}" ajax="true" styleClass="imagenBusqueda" oncomplete="candidateDetailDialog.show();" process=":viewFolderForm:facesWrapPanel" update=":viewFolderForm:candidateDetailDialog">  
                                                <h:graphicImage rendered="#{adquiredProfile.candidate.bustBlackWhite==null}" styleClass="imagenBusqueda" library="images" name="silueta1.png"></h:graphicImage>                            
                                                <h:graphicImage rendered="#{adquiredProfile.candidate.bustBlackWhite!=null}" styleClass="imagenBusqueda" value="/candidateFiles/#{adquiredProfile.candidate.idCandidate.toString()}/images/#{adquiredProfile.candidate.bustBlackWhite}"></h:graphicImage>                            
                                            </p:commandLink> 
                                            <h:outputText styleClass="polaroidText" value="#{adquiredProfile.candidate.name}, #{adquiredProfile.candidate.yearsOld}"></h:outputText>
                                        </h:panelGrid>  
                                    </p:panel> 
                                </p:column>
                            </p:dataGrid>
                        </p:panel>
                    <h:outputScript library="javascript" name="viewFolder.js"></h:outputScript>
                    <script type="text/javascript">
                        iniciarPaginaViewFolder();
                    </script>
                    <p:panel styleClass="adquiredFacesPanelWrap">
                        <p:panel id="relatedSearchsPanel" styleClass="adquiredFacesPanel adquiredFacesDataGrid noBorder">
                            <div class="viewCandidateColumnTitle interestBackgroundButton right">
                                <span>#{messages.RelatedSearchs}</span>
                            </div>
                            <p:dataGrid emptyMessage="#{messages.NoCandidatesInFolder}" styleClass="noBorder adquiredFacesDataGrid" id="searchsDataGrid" var="search" value="#{viewFolderBean.currentFolder.searchList}" columns="2" rows="#{viewFolderBean.currentFolder.searchList.size()}" paginator="false" >
                                <p:column styleClass="selectedRightMarginPanel noPadding noMargin">
                                    <p:panel styleClass="noMargin noPadding noBorder selectedRightMarginPanel">  
                                            <p:commandLink styleClass="center adquiredImage" update=":viewFolderForm:searchDetailDialog" oncomplete="searchDetailDialog.show()" actionListener="#{searchListBean.setSearchAndSearchCandidates(search)}" process="@parent">
                                                <h:graphicImage style="margin-top: 5px" styleClass="imagenSearch" library="images" name="white-glass.png"></h:graphicImage>                            
                                                <h:outputText styleClass="miniSearchText selectedTextUnit" value="#{search.description}"></h:outputText>
                                            </p:commandLink>
                                    </p:panel> 
                                </p:column>
                            </p:dataGrid>
                        </p:panel>
                    </p:panel>    
                </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>
        
    </body>
</html>
